package com.ssm.dao.mybatis.employee;

import java.util.List;

import org.mybatis.spring.support.SqlSessionDaoSupport;

import com.ssm.dto.mybatis.Employee;

public class EmployeeDAOImpl extends SqlSessionDaoSupport implements
		IEmployeeDAO {

	public void insertEmployee(Employee employee) {
		getSqlSession().insert("emp.newEmployee", employee);
	}

	public int insertEmployeeList(List<Employee> employeelist) {
		int result = 0;
		for (Employee employee : employeelist) {
			int tempResult = getSqlSession().insert("emp.newEmployee",
					employee);
			result = result + tempResult;
		}
		return result;
	}

	@SuppressWarnings("unchecked")
	public List<Employee> query(Employee employee) {
		return getSqlSession().selectList("emp.queryEmployee", employee);
	}

	@Override
	public int deleteAll() {
		return getSqlSession().delete("emp.deleteAll");
	}

}
